function [shiftedx] = ramanshift(datax, exwave)
%       [shiftedx] = ramanshift(datax, exwave)
%
% converts DATAX from wavelength into Ramanshifts, using EXWAVE as the
% LASER wavelength. Based on the Formula
%
%       DeltaW = (1/Laser - 1/Signal)
%
%
% INPUT:    datax       = (1,x) array of wavelength data
%           exwave      = wavelength of exitation Laser
%
% OUTPUT:   shiftedx    = (1,x) array of Raman shift data

%  (c) F. Dworkowski, 2011

% Help if called without argument
if nargin < 2
    help ramanshift
    return
end
tic
lengx = length(datax);
shiftedx = zeros(1,lengx);                      % predifne empty vector

% for i=1:lengx
%     shiftedx(1,i)=((1/exwave)-(1/datax(1,i)));  % shifting
%     if shiftedx(1,i)<1                          % conversion to (1/cm)
%         shiftedx(1,i)=(shiftedx(1,i)*10000000);
%     end        
% end

shiftedx=((1/exwave)-(1./datax));  % Shifting (Vecorized)
 if shiftedx(1,1)<1                % conversion to (1/cm)
     shiftedx=shiftedx*1e7;
 end        
toc